import React, { useEffect, useState } from 'react'

export default function App() {
  let [changeNum , setChangeNum] = useState(1);
  useEffect(() => {
    const clearTimer = setInterval(() => {
      changeNum -= 0.1;
      if(changeNum <= 0){
        changeNum = 1
        
      }
      setChangeNum(changeNum)
    },300);
    return () => {
      clearInterval(clearTimer)
    }
  },[])
  return (
    <div>
      <h1 style = {{opacity:changeNum}}>我感觉我透明啦</h1>
    </div>
  )
}
